using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CollegeShop.Infrastructure.Entities.Repository;
using CollegeShop.Infrastructure.Entities.Enum;

namespace CollegeShop.Infrastructure.Entities.Entity
{
    public class Anonymous : IAccessible<T_Anonymous, Anonymous>, ILogicEntity<T_Anonymous, Anonymous>
    {
        public int ID { get; set; }

        public string ClientCode { get; set; }

        public DateTime OnlineTime { get; set; }

        public ClientType ClientType { get; set; }

        protected override void Covariant(T_Anonymous model)
        {
            if (model != null)
            {
                    this.ID = model.ID;
                    this.ClientCode = model.ClientCode;
                    this.OnlineTime = model.OnlineTime;
                    this.ClientType = (ClientType) model.ClientType;
            }
        }
        protected override T_Anonymous Inverter(Anonymous model)
        {
            if (model != null)
            {
                return new T_Anonymous()
                {
                    ID = model.ID,
                    ClientCode = model.ClientCode,
                    OnlineTime = model.OnlineTime,
                    ClientType = (int)model.ClientType,
                };
            }
            return null;
        }
        public Anonymous Set(T_Anonymous dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
